package org.example.design.abstractFactory;

import org.example.design.abstractFactory.itf.CacheService;
import org.example.design.abstractFactory.itf.impl.CacheServiceImpl;
import org.example.design.abstractFactory.itf.impl.EGMCacheAdapter;
import org.example.design.abstractFactory.itf.impl.IIRCacheAdapter;
import org.example.design.abstractFactory.itf.impl.NormolCacheAdapter;
import org.example.design.abstractFactory.proxy.JDKProxy;

/**
 * @Classname Test
 * @Description 抽象工厂测试类
 * @Date 2020/10/30 4:49 下午
 * @Created by xiangjd
 */
public class Test {
    public static void main(String[] args) throws Exception {
        CacheService proxy_EGM = JDKProxy.getProxy(CacheServiceImpl.class,new EGMCacheAdapter());
        proxy_EGM.set("user_name_01","小傅哥");
        String val01 = proxy_EGM.get("user_name_01");
        System.out.println(val01);

        System.out.println("========================");

        CacheService proxy_IIR = JDKProxy.getProxy(CacheServiceImpl.class, new IIRCacheAdapter());
        proxy_IIR.set("user_name_02","小城");
        String val02 = proxy_IIR.get("user_name_02");
        System.out.println(val02);

        System.out.println("========================");

        CacheService proxy_nor = JDKProxy.getProxy(CacheServiceImpl.class, new NormolCacheAdapter());
        proxy_nor.set("user_name_normol","普通人");
        String val03 = proxy_nor.get("user_name_normol");
        System.out.println(val03);
    }
}
